package com.drought.rained.business;

import com.alibaba.android.arouter.launcher.ARouter;
import com.drought.rained.cache.UserInfoLJ;
import com.drought.rained.common.ConstantLJ;
import com.drought.rained.response.BaseResponseLJ;

import io.reactivex.functions.Consumer;

public abstract class CustomConsumerLJ<T extends BaseResponseLJ> implements Consumer<T> {

    @Override
    public void accept(T t) throws Exception {
        if (t.getStatus() == ConstantLJ.LOGIN_TIMEOUT) {
            ARouter.getInstance().build(RouterMapLJ.FACEBOOKLOGIN).navigation();
            UserInfoLJ.logout();
            return;
        }
        call(t);
    }

    public abstract void call(T t);
}
